﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BAASearchLib;
using System.Threading;

namespace Tryouts
{
    public partial class Form1 : Form
    {
        private IList<ResultItem> thelist = new BindingList<ResultItem>();


        public Form1()
        {
            InitializeComponent();

            bindingSource1.DataSource = thelist;
            dataGridView1.DataSource = bindingSource1;

            Control.CheckForIllegalCrossThreadCalls = false;
        }

        private void buttonSelectFolder_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            DialogResult dr = dialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                //thelist.Clear();
                //BAASearch search; search = new BAASearch(dialog.SelectedPath, textBox1.Text, "", null, null, textBox2.Text, "", thelist);
                //search.searchingFolderEvent += new SearchingFolderEvent(search_searchingFolderEvent);

                //Thread seachThread = new Thread(new ThreadStart(search.Search));
                //seachThread.Start();
            }
        }

        void search_searchingFolderEvent(string path)
        {
            lblSearchFolder.Text = path;
        }
    }
}
